<%--
  Created by IntelliJ IDEA.
  User: HI
  Date: 2024/4/24
  Time: 23:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@page import="beans.*"%>
<%@page import="java.util.List" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
</head>
<body>
<h1 align="center">欢迎登录书籍查询界面</h1><br>
    <!-- 以下HTML代码段用于显示查询出来的数据 -->
    <form action="/BOOK_war_exploded/Book" method="post">
        搜索：
        <input type="text" name="name">
        <input type="hidden" name="ok" value="1">
        <button type="submit" name="action" id="b1" value="b1">搜一下</button>
    </form>

<%
    List <Book> list=(List<Book>)request.getAttribute("allBook");
%>
<table border="1">
    <tr>
        <td>id</td><td>name</td><td>press</td><td>author</td><td>price</td>
        <td>修改</td><td>删除</td>
    <tr/>
    <%
        if(list!=null){
            for(int i=0;i<list.size();i++){
    %>
    <tr>
        <td><%=list.get(i).getBook_id()%></td><td><%=list.get(i).getBook_name() %></td>
        <td><%=list.get(i).getBook_press() %></td><td><%=list.get(i).getBook_author() %></td>
        <td><%=list.get(i).getBook_price() %></td>

        <%String editURL="Book?action=toEdit&id="+list.get(i).getBook_id(); %>
        <td><a href=<%=editURL %>>修改</a></td>
        <%String deleteURL="Book?action=toDel&id="+list.get(i).getBook_id(); %>
        <td><a href=<%=deleteURL %>>删除</a></td>
    </tr>
    <%  }
    }
%>
</table>
<a href="add.jsp">新增用户</a>

</body>
</html>
